﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TestOnlineProject.Models.Entities;
using TestOnlineProject.Models.DataAccess;

namespace TestOnlineProject.Models.BusinessLogic
{
    public class TestTypeBLO
    {
        TestTypeDAO testTypeDAO = new TestTypeDAO();

        public List<TestType> ToList()
        {
            var testTypes = testTypeDAO.Select();

            // If user is student, just get quick test.
            if (HttpContext.Current.User.IsInRole("3"))
            {
                testTypes = testTypes.Where(t => t.TestTypeId == 2).ToList();
            }

            return testTypes;
        }
    }
}